package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.CustomerProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/customer")
@Api(tags = "小程序端护理项目模块")
public class CustomerProjectController extends BaseController {

    @Autowired
    private CustomerProjectService customerProjectService;

    /**
     * 分页查询护理项目
     * @param pageNum
     * @param pageSize
     * @param name
     * @param status
     * @return
     */
    @ApiOperation("分页查询护理项目")
    @GetMapping("/orders/project/page")
    private ResponseResult<PageResponse<NursingProjectVo>> GetPage(
      @ApiParam("页码")   @RequestParam(value = "pageNum",required = true) Integer pageNum,
      @ApiParam("显示条数")  @RequestParam(value = "pageSize",required = true) Integer pageSize,
      @ApiParam("名称")  @RequestParam(value = "name",required = false) String name,
      @ApiParam("状态")  @RequestParam(value = "status",required = false) Integer status
    ){
        PageResponse<NursingProjectVo> voPageResponse =  customerProjectService.getProjectPage(pageNum,pageSize,name,status);
        return ResponseResult.success(voPageResponse);
    }

    /**
     * 根据id查询护理项目
     * @return
     */
    @ApiOperation("根据id查询")
    @GetMapping("/orders/project/{id}")
    private ResponseResult<NursingProjectVo> getById(@PathVariable @ApiParam("查询护理项目id") Long id){
        NursingProjectVo nursingProjectVo = customerProjectService.getById(id);
        return ResponseResult.success(nursingProjectVo);
    }
}
